/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.easoftware.code.beans.jpa;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;

/**
 *
 * @author Eliu
 */
@Entity
@Table(name = "target_year")
@NamedQueries({
    @NamedQuery(name = "TargetYear.findAll", query = "SELECT t FROM TargetYear t"),
    @NamedQuery(name = "TargetYear.findById", query = "SELECT t FROM TargetYear t WHERE t.id = :id"),
    @NamedQuery(name = "TargetYear.findByNombre", query = "SELECT t FROM TargetYear t WHERE t.nombre = :nombre"),
    @NamedQuery(name = "TargetYear.findByTipo", query = "SELECT t FROM TargetYear t WHERE t.tipo = :tipo"),
    @NamedQuery(name = "TargetYear.findByAnio", query = "SELECT t FROM TargetYear t WHERE t.anio = :anio")})
public class TargetYear implements Serializable {

    @JoinColumn(name = "unidad_negocio", referencedColumnName = "id")
    @ManyToOne
    private UnidadNegocio unidadNegocio;
    @JoinColumn(name = "linea_negocio", referencedColumnName = "id")
    @ManyToOne
    private LineaNegocio lineaNegocio;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Size(max = 20)
    @Column(name = "nombre")
    private String nombre;
    @Column(name = "tipo")
    private Integer tipo;
    @Column(name = "anio")
    private Integer anio;
    @Column(name = "valor")
    private Float valor;

    public Float getValor() {
        return valor;
    }

    public void setValor(Float valor) {
        this.valor = valor;
    }

    public TargetYear() {
    }

    public TargetYear(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Integer getTipo() {
        return tipo;
    }

    public void setTipo(Integer tipo) {
        this.tipo = tipo;
    }

    public Integer getAnio() {
        return anio;
    }

    public void setAnio(Integer anio) {
        this.anio = anio;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += ( id != null ? id.hashCode() : 0 );
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!( object instanceof TargetYear )) {
            return false;
        }
        TargetYear other = (TargetYear) object;
        if (( this.id == null && other.id != null ) || ( this.id != null && !this.id.equals(other.id) )) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "net.easoftware.code.beans.jpa.TargetYear[ id=" + id + " ]";
    }

    public UnidadNegocio getUnidadNegocio() {
        return unidadNegocio;
    }

    public void setUnidadNegocio(UnidadNegocio unidadNegocio) {
        this.unidadNegocio = unidadNegocio;
    }

    public LineaNegocio getLineaNegocio() {
        return lineaNegocio;
    }

    public void setLineaNegocio(LineaNegocio lineaNegocio) {
        this.lineaNegocio = lineaNegocio;
    }
}
